package ru.kreda.webapp.client.ui;

import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;

/**
 * Диалог для отображения формы.
 */
public class FormUIDialog extends WindowBasedUIDialog {
	private final IDialogForm form;

	public FormUIDialog(IDialogForm form) {
		this.form = form;
		setSize(350, 250);
	}

	@Override
	protected Window create() {
		Window window = new Window();
		window.setFrame(true);
		window.setHeading(form.getHeading());
		window.setModal(true);
		window.setBlinkModal(true);
		window.setBodyBorder(false);
		window.setLayout(new FitLayout());
		window.setButtonAlign(HorizontalAlignment.CENTER);
		window.add(form.asWidget());
		form.setWindow(window);
		return window;
	}

}
